Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for moving cursor on spacebar slide. Fixes #91 #401

Merged
merged 6 commits into from
Sep 14, 2023

Conversation

storvik
Copy link
Contributor

@storvik storvik commented Sep 10, 2023

I tried to tackle issue #91.

This pull request adds two settings:

  • Spacebar slide: Enable / Disable spacebar sliding
  • Slide sensitivity: Sensitivity when sliding

Also KeyItemC was extended with slideType. Slide type defaults to NONE, which is the old behavior. MOVE_CURSOR slide type is for keys meant to be used with the new "slide to move cursor"-functionality. The thought was to also extend this with another type. DELETE, which marks characters backwards on slide and deletes them on release (like florissboard and Gboard). If slideType is MOVE_CURSOR and the setting is turned off, spacebar will behave like it does now. In other words, this should not break default behavior.

See gif for a simple demo

ThumbKey

Not sure if these modifications are OK to you, but it seems to be working fine on my end now. I'm no Android developer, so any feedback is much welcome!

@storvik
Copy link
Contributor Author

storvik commented Sep 11, 2023

After using this for a day I noticed that scrolling past text could move focus out of text field. Seems like DPAD is used for navigation between UI elements too, that's probably why this happens.

Latest additions in 571fdc7 checks if length of text before / after cursor is 0. If there is no more text it aborts the movement and resets sliding offset.

So far this is working great, and I have tested it in every application where the focus issue was present. That is Messenger, Teams and Snapchat.

@sslater11
Copy link
Contributor

sslater11 commented Sep 12, 2023

Oh wow, this looks awesome! I've wanted this feature for a while and was wondering how to implement it.
Thank you 😁!

@storvik
Copy link
Contributor Author

storvik commented Sep 12, 2023

Thanks @sslater11! Please take it for a test-drive if you get a chance. So far it's working great for me.

Copy link
Owner

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is gonna be a great addition, thx for this!

The main thing that I commented on below, is that sliding might also be useful in the future for the delete key, so I'd rename it from spacebar_side to something more generic.

@storvik
Copy link
Contributor Author

storvik commented Sep 12, 2023

@dessalines thanks for the feedback!

I agree that slide_enabled is better, so that fixed. Also migrations are now combined, wasn't aware that I could do that.

@storvik
Copy link
Contributor Author

storvik commented Sep 12, 2023

I haven't noticed that the spacebar wasn't being released until you mentioned it. Fixed it by calling the doneKeyAction function after slide. Seems to be working correctly now.

When this is merged I will try to look into "slide to delete". Didn't find an obvious way to implement that yet, and as I'm very new to android development things have a tendency to take some time.

Copy link
Owner

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and it works great, thx!

@dessalines dessalines merged commit 27263f3 into dessalines:main Sep 14, 2023
@storvik storvik deleted the feature-sliding-cursor branch September 18, 2023 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants